<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<script type="text/javascript" src="jquery-3.1.4.js">
		
	</script>
	<style type="text/css">
		#box1{
			width: 200px;
			height: 200px;
			background: #0000FF;
		}
		#box2{
			width: 200px;
			height: 200px;
			background: pink;
		}
		#bbx1{
			width: 200px;
			height: 200px;
			background: green;
		}
		#bbx2{
			width: 200px;
			height: 200px;
			background: yellow;
		}
	</style>
	<body>
		<div id="box1">
			
		</div>
		<div id="box2">
			
		</div>
		<div id="bbx1">
			
		</div>
		<div id="bbx2">
			
		</div>
		<input type="button" id="box_button" value="属性选择器" />
		<input type="button" id="box_button2" value="属性选择器开头决定" />
		<input type="button" id="box_button3" value="属性选择器末尾决定" />
		<input type="button" id="box_button4" value="属性选择器包含决定" />
		<script type="text/javascript">
			// 调用鼠标按钮的点击触发事件
			$("#box_button").click(function(){
				// 调用具体标签下的css改变触发事件
				$("div[id=box1]").css("background","red");// 条件语句可以不或加引号
			});
			// 前缀为bb即可实现css变化
			$("#box_button2").click(function(){
				$("div[id^=bb]").css("background","red");
			});
			// 以2为结尾可实现css变化
			$("#box_button3").click(function(){
				$("div[id$=2]").css("background","red");
			});
			// 以包含o字母实现css变化
			$("#box_button4").click(function(){
				$("div[id*=o]").css("background","red");
			});
			
		</script>
	</body>
</html>
